#include "junix.h"

int main(int argc, char **argv)
{
	int fd=dup(STDOUT_FILENO);

	if(fd<0)
		err_sys("dup");

	printf("dup fd:%d\n",fd);

	char  buf[100]="hello,world!\n";
	write(fd, buf, strlen(buf) );

	if(dup2(fd,9)==-1)
		err_sys("dup2");

	write(9, buf, strlen(buf) );

	return 0;
}

